from flask import Blueprint
from flask_restful import Api

from comment.utils.output import output_json

#创建蓝图
index_bp=Blueprint('index',__name__,url_prefix='/index')

#在蓝图中创建api
index_api=Api(index_bp)#参数是index_bp蓝图


#可以用representations替代representations装饰器的写法 写一行这个函数放到蓝图中 就这个模块的所有资源都可以使用了 就不用像装饰器那样每个资源都要写一遍
index_api.representation('application/json')(output_json)#定义好资源的输出格式  下一步就是添加资源类

from Shonpping.resources.index.index_resource import *

index_api.add_resource(Shopping_Category,'/category',endpoint='category')#将资源类添加进api中


index_api.add_resource(Shopping_HomeNewProduct,'/home_new_product',endpoint='home_new_product')

index_api.add_resource(Shopping_HomeRecommendProduct,'/home_recommend_product',endpoint='home_recommend_product')

index_api.add_resource(Shopping_RecommendSubject,'/recommend_subject',endpoint='recommend_subject')